<?php
echo "<meta http-equiv='content-type' content='text/html; charset=utf-8' />";
include ("class/database.php");
$db = new db();
$status_connect = $db->connect();
if($status_connect)
{
	if ($_REQUEST['do'] == "add"){
		$txtName = $_REQUEST['txtName'];
		$txtAddFarm = $_REQUEST['txtAddFarm'];
		$txtNumFarm = $_REQUEST['txtNumFarm'];
		$card = $_REQUEST['card'];
		$Reg = $_REQUEST['Reg'];
		$Certificate = $_REQUEST['Certificate'];
		$Guaranty = $_REQUEST['Guaranty'];
		$Medical = $_REQUEST['Medical'];
		$Map = $_REQUEST['Map'];
		$Chart = $_REQUEST['Chart'];
		$Permit = $_REQUEST['Permit'];
		$Detail = $_REQUEST['Detail'];
		$Remote = $_REQUEST['Remote'];
		$tag = $_REQUEST['tag'];
		$Sprayed = $_REQUEST['Sprayed'];
		$Shower = $_REQUEST['Shower'];
		$Office = $_REQUEST['Office'];
		$Equipment = $_REQUEST['Equipment'];
		$Food = $_REQUEST['Food'];
		$Water = $_REQUEST['Water'];
		$Alarms = $_REQUEST['Alarms'];
		$Eggs = $_REQUEST['Eggs'];
		$House = $_REQUEST['House'];
		$Solution = $_REQUEST['Solution'];
		$Trashcan = $_REQUEST['Trashcan'];
		$storage = $_REQUEST['storage'];
		$Gutters = $_REQUEST['Gutters'];
		$waste = $_REQUEST['waste'];
		
		$query_status = $db->insert("evidence",
											"Name,Address,NumFarm,
											Identity_Card,Registration,Certificate,
											Credentials,Medical_Certificate,Map_Farm,
											Diagram,Permit,Detailed_Location,
											Remote_Photo,Label_Photo,Solution_Photo,
											Bathroom_Photo,Office_Photo,Equipment_Photo,
											Food_Photo,Water_Photo,Alarms_Photo,
											Egg_Photo,House_Photo,Dipping_Photo,
											Trashcan_Photo,Drying_Photo,Gutter_Photo,
											Removal_Photo",
											"'$txtName','$txtAddFarm','$txtNumFarm',
											$card,$Reg,$Certificate,
											$Guaranty,$Medical,$Map,
											$Chart,$Permit,$Detail,
											$Remote,$tag,$Sprayed,
											$Shower,$Office,$Equipment,
											$Food,$Water,$Alarms,
											$Eggs,$House,$Solution,
											$Trashcan,$storage,$Gutters,
											$waste");
		if($query_status){
			echo "บันทึกข้อมูลเรียบร้อยแล้ว";
			echo "<meta http-equiv='refresh' content='5;url=Information.html'>";
		}else{
			echo "ไม่สามารถบันทึกข้อมูลได้";
		}
											
		
	}//end add
}else{
	echo "ไม่สามารถติดต่อฐานข้อมูลได้";
}//end connect
?>